/*
 * @Author: liutongchao 1923236391@qq.com
 * @Date: 2023-04-25 17:16:48
 * @LastEditors: liutongchao 1923236391@qq.com
 * @LastEditTime: 2025-02-27 11:50:57
 * @FilePath: \greenbeeadmin\routers\router.go
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package routers

import (
	"greenbeeadmin/controllers"
	AdminController "greenbeeadmin/controllers/admin"
	ApiController "greenbeeadmin/controllers/api"
	greenbee "greenbeeadmin/controllers/greenbee"
	"greenbeeadmin/middleware"

	beego "github.com/beego/beego/v2/server/web"
)

func init() {
	// 安装验证中间件
	letGoUrlItem := []string{"/install", "/installSuccess"}
	middleware.CheckInstalled(letGoUrlItem)
	/** 系统初始化安装路由 **/
	beego.Router("/install", &greenbee.CmfInstallController{})
	beego.Router("/installSuccess", &greenbee.CmfInstallSuccessController{})

	/** 前台路由 **/
	beego.Router("/", &controllers.MainController{})

	/** api接口路由 **/
	beego.Router("/api/demo", &ApiController.ApiDemoController{})

	/** 后台路由 **/
	//全局放行路由
	urlItem := []string{"/page/getVerifyCode", "/admin/login", "/admin/logOut", "/admin/forgetPass"}
	//权限放行路由
	passItem := []string{"/admin/main/clear", "/admin/main/userSetting", "/admin/main/userPassword", "/admin/menu", "/admin"}

	// 后台登录验证中间件
	middleware.AdminCheckLogin(urlItem, passItem)
	// 后台首页
	beego.Router("/admin", &AdminController.AdminController{})
	// 登陆
	beego.Router("/admin/login", &AdminController.AdminLoginController{})
	beego.Router("/admin/logOut", &AdminController.AdminLogOutController{})
	beego.Router("/admin/forgetPass", &AdminController.AdminForgetPassController{})
	// 主页，顶部导航功能
	beego.Router("/admin/main", &AdminController.AdminMainController{})
	beego.Router("/admin/main/userSetting", &AdminController.AdminUserSettingController{})
	beego.Router("/admin/main/userPassword", &AdminController.AdminUserPasswordController{})
	beego.Router("/admin/main/clear", &AdminController.AdminClearController{})
	// 主菜单接口
	beego.Router("/admin/menu", &AdminController.MenuController{})
	// 系统设置
	beego.Router("/admin/systemSet", &AdminController.SystemSetController{})
	beego.Router("/admin/emailSet", &AdminController.EmailSetController{})
	beego.Router("/admin/emailTest", &AdminController.EmailTestController{})
	// 管理员管理
	beego.Router("/admin/adminUser", &AdminController.AdminUserController{})
	beego.Router("/admin/adminUser/add", &AdminController.AddAdminUserController{})
	beego.Router("/admin/adminUser/edit", &AdminController.EditAdminUserController{})
	beego.Router("/admin/adminUser/del", &AdminController.DelAdminUserController{})
	// 权限管理
	beego.Router("/admin/rbac/roleList", &AdminController.RbacRoleListController{})
	beego.Router("/admin/rbac/roleAdd", &AdminController.RbacAddRoleController{})
	beego.Router("/admin/rbac/roleEdit", &AdminController.RbacEditRoleController{})
	beego.Router("/admin/rbac/roleMenu", &AdminController.RbacRoleMenuController{})
	beego.Router("/admin/rbac/roleDel", &AdminController.RbacDelRoleController{})
	beego.Router("/admin/rbac/menu", &AdminController.RbacMenuController{})
	beego.Router("/admin/rbac/menuAdd", &AdminController.RbacMenuAddController{})
	beego.Router("/admin/rbac/menuEdit", &AdminController.RbacMenuEditController{})
	beego.Router("/admin/rbac/menuDel", &AdminController.RbacMenuDelController{})
	// 组件管理
	beego.Router("/admin/page/uEdit", &AdminController.PageUeditController{})
	beego.Router("/admin/page/upload", &AdminController.PageUploadController{})
	beego.Router("/admin/page/icon", &AdminController.PageIconController{})
	beego.Router("/admin/page/iconPicker", &AdminController.PageIconPickerController{})
	beego.Router("/admin/page/colorSelect", &AdminController.PageColorSelectController{})
	beego.Router("/admin/page/tableSelect", &AdminController.PageTableSelectController{})
	beego.Router("/admin/page/area", &AdminController.PageAreaController{})
	beego.Router("/admin/page/from", &AdminController.PageFromController{})
	beego.Router("/admin/page/button", &AdminController.PageButtonController{})
	beego.Router("/admin/page/table", &AdminController.PageTableController{})

	/** 其他路由 **/
	beego.Router("/page/error", &greenbee.AdminErr404Page{})
	beego.Router("/page/upload", &greenbee.CmfUploadFileController{})
	beego.Router("/page/getVerifyCode", &greenbee.CmfCaptchaController{})
	beego.Router("/page/ueditor/controller", &greenbee.UeditorUploadImageController{})

}
